package com.gujh.security.util;

import org.springframework.util.Assert;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class CacheUtil {

    private static final Map<String, String> smsCodeCache = new ConcurrentHashMap<>();

    public static String getCodeByPhone(String phone) {
        Assert.hasText(phone, "手机号不能为空");
        return smsCodeCache.get(phone);
    }

    public static void putCode(String phone, String code) {
        smsCodeCache.put(phone, code);
    }
}
